﻿using System.IO;
using System.Windows;

namespace WpfSample
{
    /// <summary>
    /// MarkDownRenderView.xaml 的交互逻辑
    /// </summary>
    // ReSharper disable once RedundantExtendsListEntry
    public partial class MarkDownRenderView : System.Windows.Controls.UserControl
    {
        public MarkDownRenderView()
        {
            InitializeComponent();
        }

        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            var openFileDialog = new OpenFileDialog()
            {
                Filter = @"Markdown files (*.md)|*.md|All files (*.*)|*.*" //选择的文件类型的筛选器
            };
            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            TextBoxFilePath.Text = openFileDialog.FileName;
            MarkdownViewer.Markdown = File.ReadAllText(openFileDialog.FileName);
        }
    }
}
